<?php
namespace Plugin\Alarm\Schema;

use Plugin\Alarm\Model\RdAlarmType;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 报警消息类型
 */
#[Schema(title: 'RdAlarmTypeSchema')]
class RdAlarmTypeSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: 'id', type: 'int')]
    public string $id;

    #[Property(property: 'name', title: '消息名', type: 'varchar')]
    public string $name;

    #[Property(property: 'voice_id', title: '语音播报ID', type: 'bigint')]
    public string $voice_id;

    #[Property(property: 'type', title: '类型1:摄像机2:雷达', type: 'tinyint')]
    public string $type;

    #[Property(property: 'sort', title: '排序', type: 'int')]
    public string $sort;

    #[Property(property: 'level', title: '风险等级1:创建工单2:喊话处理3:需查看4:预警', type: 'tinyint')]
    public string $level;

    #[Property(property: 'risk_level', title: '工单紧急程度1:一般2:紧急3:非常紧急', type: 'tinyint')]
    public string $risk_level;

    #[Property(property: 'risk_title', title: '预警信息标题', type: 'varchar')]
    public string $risk_title;

    #[Property(property: 'risk_text', title: '预警文本', type: 'varchar')]
    public string $risk_text;
    
    #[Property(property: 'expire_time', title: '工单整改限时', type: 'int')]
    public string $expire_time;
    
    #[Property(property: 'icon', title: '图标', type: 'varchar')]
    public string $icon;

    #[Property(property: 'created_by', title: '创建者', type: 'bigint')]
    public string $created_by;

    #[Property(property: 'updated_by', title: '更新者', type: 'bigint')]
    public string $updated_by;

    #[Property(property: 'created_at', title: 'created_at', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'timestamp')]
    public string $updated_at;


    public function __construct(RdAlarmType $model)
    {
       $this->id = $model->id;
       $this->name = $model->name;
       $this->voice_id = $model->voice_id;
       $this->type = $model->type;
       $this->sort = $model->sort;
       $this->level = $model->level;
       $this->risk_level = $model->risk_level;
       $this->risk_title = $model->risk_title;
       $this->risk_text = $model->risk_text;
       $this->expire_time = $model->expire_time;
       $this->icon = $model->icon;
       $this->created_by = $model->created_by;
       $this->updated_by = $model->updated_by;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'name' => $this->name ,'voice_id' => $this->voice_id ,'type' => $this->type ,'sort' => $this->sort ,'level' => $this->level, 'risk_level' => $this->risk_level ,'risk_title' => $this->risk_title ,'risk_text' => $this->risk_text ,'expire_time' => $this->expire_time ,'icon' => $this->icon ,'created_by' => $this->created_by ,'updated_by' => $this->updated_by ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at];
    }
}